//
//  ZMPictureCell.swift
//  ZMWeiboSwift
//
//  Created by pg on 2017/7/28.
//  Copyright © 2017年 pg. All rights reserved.
//

import UIKit

class ZMPictureCell: UICollectionViewCell {
    
    //懒加载imageView
     lazy var imageview : UIImageView = {
       
        let imageview = UIImageView(image:UIImage(named:"timeline_image_placeholder"))
        
        imageview.contentMode = .scaleAspectFill
        imageview.clipsToBounds = true
        
        return imageview
    }()
    
    //模型数据
    var homePic: ZMPicUrlModel?{
        didSet{
            
            if let urlstr = homePic?.thumbnail_pic {
                imageview.sd_setImage(with: URL(string:urlstr), placeholderImage: UIImage(named:"timeline_image_placeholder"))
            }
            
        }
    }
    
    override init(frame: CGRect) {
        super.init(frame: frame)
        
        setupUI()
        
        
    }
    
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    
    //MARK:- 初始化UI
    func setupUI(){
        
        contentView.addSubview(imageview)
        imageview.snp.makeConstraints { (make) in
            make.edges.equalTo(contentView)
        }
        
        
    }
    
    
}
